package com.shan.design.visitor;

/**
 * description
 * 财务部类：具体访问者类
 *
 * @author shanzheng <br/>
 * @date 14:53 2018/11/29.<br/>
 * Modified By <br/>
 */
public class FADepartment extends Department {
    /**
     * Description 财务对全职员工的访问
     *
     * @param employee
     * @return void
     * @author shanzheng
     * date  2018/11/29
     */
    @Override
    void visit(FulltimeEmployee employee) {
        int workTime = employee.getWorkTime();
        double weekWage = employee.getWeeklyWage();
        if (workTime > 40) {
            weekWage = weekWage + (workTime - 40) * 100;
        } else if (workTime < 40) {
            weekWage = weekWage - (40 - workTime) * 80;
            if (weekWage < 0) {
                weekWage = 0;
            }
        }
        System.out.println("正式员工" + employee.getName() + "实际工资为：" + weekWage + "元。");
    }

    /**
     * Description 财务对临时员工的访问
     *
     * @param employee
     * @return void
     * @author shanzheng
     * date  2018/11/29
     */
    @Override
    void visit(ParttimeEmployee employee) {
        int workTime = employee.getWorkTime();
        double hourWage = employee.getHourWage();
        System.out.println("临时工" + employee.getName() + "实际工资为：" + workTime * hourWage + "元。");
    }
}
